<div class="row-fluid">
	<h3 class="widget-name">My Projects</h3>
	<table class="table table-bordered table-condensed">		
<tr>
	<th>Project Name</th>
	<th>Team Leader</th>
	<th colspan="2">Due Date</th>	
</tr>


<?php 
$project_ids[]=NULL;
foreach($my_projects as $project){
	$project_ids[]= $project->project_id;
	?>
<tr>
	<td><!--<a class="tooltips" title="<?php echo $project->name ?>" href="<?php echo site_url('/user/tasks/milestones_details/'.$project->id) ?>"><?php echo $project->name?></a>-->
	<a class="tooltips" title="<?php echo $project->name ?>" href="<?php echo site_url('/user/tasks/milestones_details/'.$project->project_id) ?>"><?php echo $project->name?></a>
	
	</td>
	<td><?php echo ucfirst($this->common_model->get_username_id($project->assigned_to))?></td>
	<td><?php echo $project->end_date?></td>
	<td>
	<?php 
	// get fav
	$fav = $this->task_model->get_fav_project($project->project_id,$this->session->userdata('user_id'));	
	if(count($fav)==0){
	?>
	<a href="javascript:void(0)"  id="fav" onclick="add_fav_project(<?php echo $project->project_id;?>)"><i class="icon-star-empty" id="star"></i> </a>
	<?php }else{?>	
	<a href="javascript:void(0)"  id="nofav" onclick="remove_fav_project(<?php echo $project->project_id;?>)" ><i class="icon-star" id="star"></i> </a>
	<?php }?>
	</td>
</tr>
<?php }?>


<?php
 $remain_projects =  $this->task_model->remaining_my_projects();
	foreach($remain_projects as $remain){
		if(!(in_array($remain->id,$project_ids))){
		?>
<tr>
	<td><!--<a class="tooltips" title="<?php echo $project->name ?>" href="<?php echo site_url('/user/tasks/milestones_details/'.$project->id) ?>"><?php echo $project->name?></a>-->
	<a class="tooltips" title="<?php echo $remain->name ?>" href="<?php echo site_url('/user/tasks/milestones_details/'.$remain->id) ?>"><?php echo $remain->name?></a>
	
	</td>
	<td><?php echo ucfirst($this->common_model->get_username_id($remain->assigned_to))?></td>
	<td><?php echo $remain->end_date?></td>
	<td>
	<?php 
	// get fav
	$fav = $this->task_model->get_fav_project($remain->id,$this->session->userdata('user_id'));	
	if(count($fav)==0){
	?>
	<a href="javascript:void(0)"  id="fav" onclick="add_fav_project(<?php echo $remain->id;?>)"><i class="icon-star-empty" id="star"></i> </a>
	<?php }else{?>	
	<a href="javascript:void(0)"  id="nofav" onclick="remove_fav_project(<?php echo $remain->id;?>)" ><i class="icon-star" id="star"></i> </a>
	<?php }?>
	</td>
</tr>
<?php }}?>

		
	</table>	
</div>

<div class="row-fluid">
<h3 class="widget-name">Shared Projects</h3>
	<table class="table table-bordered table-condensed">
	<tr>
	<th>Project Name</th>
	<th>Team Leader</th>
	<th colspan="2">Due Date</th>
	</tr>
	
	<?php 
	foreach($shared_projects as $shared_project){?>
<tr>
	<td><a class="tooltips" title="<?php echo $shared_project->desc ?>" href="<?php echo site_url('/user/tasks/milestones_details/'.$shared_project->id) ?>"><?php echo $shared_project->name?></a></td>
	<td><?php echo ucfirst($this->common_model->get_username_id($shared_project->assigned_to))?></td>
	<td><?php echo $shared_project->end_date?></td>
	<td>
	<?php 
	// get fav
	$fav = $this->task_model->get_fav_project($shared_project->id,$this->session->userdata('user_id'));	
	if(count($fav)==0){
	?>
	<a href="javascript:void(0)"  id="fav" onclick="add_fav_project(<?php echo $shared_project->id;?>)"><i class="icon-star-empty" id="star"></i> </a>
	<?php }else{?>	
	<a href="javascript:void(0)"  id="nofav" onclick="remove_fav_project(<?php echo $shared_project->id;?>)" ><i class="icon-star" id="star"></i> </a>
	<?php }?>
	</td>
</tr>
<?php }?>
		
	</table>
</div>

<!--<input type="text" id="test" />-->

<script type="text/javascript">
<!--
	function add_fav_project(pId) {		
		$.post('<?= site_url("user/tasks/add_fav_project");?>',{id:pId}, function(data) {		
			location.reload();
	});
	}
	function remove_fav_project(pId) {	
		$.post('<?= site_url("user/tasks/remove_fav_project");?>',{id:pId}, function(data) {		
			
			location.reload();
	});
	}
	
	/*
	$('#test').click(function(){
		alert('hello1');	
	
	$.ajax(
			{
	  			url: "<?= base_url()?>user/tasks/testing",
	  			cache: false,
	  			dataType: "json",
				//data: {plan_id: ui.value}
	 			success: function(data) 
					{	
						alert('hello');								
						$('#test').val(data.city)
					}
				}		
				);
			});
	*/
//-->
</script>
